package com.dubbo.snail.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.concurrent.TimeUnit;

/**
 * @Description TODO
 * @Author xueguoping
 * @Date 2021/5/10 11:06
 */
@RefreshScope
@RestController
public class ProviderController {

	@Value("${server.port}")
	private String serverPort;

	@GetMapping("/getProvider")
	public String getProvider(){
		return serverPort;
	}

	@GetMapping("/getProviderTimeOut")
	public String getProviderTimeOut(){
		try {
			TimeUnit.SECONDS.sleep(3);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		return serverPort;
	}
}
